package com.young.scheduler.grpc;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.9.0)",
    comments = "Source: ShedulerService.proto")
public final class VServerSheduleServiceGrpc {

  private VServerSheduleServiceGrpc() {}

  public static final String SERVICE_NAME = "grpc.VServerSheduleService";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @Deprecated // Use {@link #getCallBackMethod()} instead.
  public static final io.grpc.MethodDescriptor<SchedulerModel.CallbackRequest,
      SchedulerModel.CallbackResponse> METHOD_CALL_BACK = getCallBackMethod();

  private static volatile io.grpc.MethodDescriptor<SchedulerModel.CallbackRequest,
      SchedulerModel.CallbackResponse> getCallBackMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<SchedulerModel.CallbackRequest,
      SchedulerModel.CallbackResponse> getCallBackMethod() {
    io.grpc.MethodDescriptor<SchedulerModel.CallbackRequest, SchedulerModel.CallbackResponse> getCallBackMethod;
    if ((getCallBackMethod = VServerSheduleServiceGrpc.getCallBackMethod) == null) {
      synchronized (VServerSheduleServiceGrpc.class) {
        if ((getCallBackMethod = VServerSheduleServiceGrpc.getCallBackMethod) == null) {
          VServerSheduleServiceGrpc.getCallBackMethod = getCallBackMethod =
              io.grpc.MethodDescriptor.<SchedulerModel.CallbackRequest, SchedulerModel.CallbackResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "grpc.VServerSheduleService", "callBack"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  SchedulerModel.CallbackRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  SchedulerModel.CallbackResponse.getDefaultInstance()))
                  .setSchemaDescriptor(new VServerSheduleServiceMethodDescriptorSupplier("callBack"))
                  .build();
          }
        }
     }
     return getCallBackMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static VServerSheduleServiceStub newStub(io.grpc.Channel channel) {
    return new VServerSheduleServiceStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static VServerSheduleServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new VServerSheduleServiceBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static VServerSheduleServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new VServerSheduleServiceFutureStub(channel);
  }

  /**
   */
  public static abstract class VServerSheduleServiceImplBase implements io.grpc.BindableService {

    /**
     */
    public void callBack(SchedulerModel.CallbackRequest request,
                         io.grpc.stub.StreamObserver<SchedulerModel.CallbackResponse> responseObserver) {
      asyncUnimplementedUnaryCall(getCallBackMethod(), responseObserver);
    }

    @Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getCallBackMethod(),
            asyncUnaryCall(
              new MethodHandlers<
                SchedulerModel.CallbackRequest,
                SchedulerModel.CallbackResponse>(
                  this, METHODID_CALL_BACK)))
          .build();
    }
  }

  /**
   */
  public static final class VServerSheduleServiceStub extends io.grpc.stub.AbstractStub<VServerSheduleServiceStub> {
    private VServerSheduleServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

    private VServerSheduleServiceStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected VServerSheduleServiceStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new VServerSheduleServiceStub(channel, callOptions);
    }

    /**
     */
    public void callBack(SchedulerModel.CallbackRequest request,
                         io.grpc.stub.StreamObserver<SchedulerModel.CallbackResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getCallBackMethod(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class VServerSheduleServiceBlockingStub extends io.grpc.stub.AbstractStub<VServerSheduleServiceBlockingStub> {
    private VServerSheduleServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private VServerSheduleServiceBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected VServerSheduleServiceBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new VServerSheduleServiceBlockingStub(channel, callOptions);
    }

    /**
     */
    public SchedulerModel.CallbackResponse callBack(SchedulerModel.CallbackRequest request) {
      return blockingUnaryCall(
          getChannel(), getCallBackMethod(), getCallOptions(), request);
    }
  }

  /**
   */
  public static final class VServerSheduleServiceFutureStub extends io.grpc.stub.AbstractStub<VServerSheduleServiceFutureStub> {
    private VServerSheduleServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private VServerSheduleServiceFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected VServerSheduleServiceFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new VServerSheduleServiceFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<SchedulerModel.CallbackResponse> callBack(
        SchedulerModel.CallbackRequest request) {
      return futureUnaryCall(
          getChannel().newCall(getCallBackMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_CALL_BACK = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final VServerSheduleServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(VServerSheduleServiceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @Override
    @SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_CALL_BACK:
          serviceImpl.callBack((SchedulerModel.CallbackRequest) request,
              (io.grpc.stub.StreamObserver<SchedulerModel.CallbackResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @Override
    @SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class VServerSheduleServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    VServerSheduleServiceBaseDescriptorSupplier() {}

    @Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.young.scheduler.grpc.ShedulerService.getDescriptor();
    }

    @Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("VServerSheduleService");
    }
  }

  private static final class VServerSheduleServiceFileDescriptorSupplier
      extends VServerSheduleServiceBaseDescriptorSupplier {
    VServerSheduleServiceFileDescriptorSupplier() {}
  }

  private static final class VServerSheduleServiceMethodDescriptorSupplier
      extends VServerSheduleServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    VServerSheduleServiceMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (VServerSheduleServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new VServerSheduleServiceFileDescriptorSupplier())
              .addMethod(getCallBackMethod())
              .build();
        }
      }
    }
    return result;
  }
}
